<?php 
header("content-type:text/html;charset=utf8");
//接值 
$name=$_POST["name"];
$pwd=$_POST["pwd"];
//连选库
$db=new PDO("mysql:host=127.0.0.1;dbname=bj07c;charset=utf8","root","root");
$sql="select * from login where name='$name' and pwd=$pwd";
$res=$db->query($sql)->fetchAll(PDO::FETCH_ASSOC);
// print_r($res);die;
if($res)
{
  $arr=array("code"=>1,"mes"=>"登录成功");
}
else
{
 $arr=array("code"=>2,"mes"=>"登录失败");
}
echo json_encode($arr);
 ?>

